home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 52 / Amiga Format AFCD52 (Issue 136, May 2000).iso / -serious- / programming / basic / mildred / lha / fdsexample1.lha / FDsMildredExample1.asc next >
Text File  |  1998-12-24  |  4KB  |  90 lines

  1. ;Wavey Logo Mildred Library Example.
  2. ;
  3. ;Programmed by : Mikkel Loekke, aka. FlameDuck.
  4. ;
  5. ;Please read the README file.
  6. ;
  7.  
  8. WBStartup
  9. NoCli
  10.  
  11. INCDIR "Ram:"     ; Change this to whereever you put this example.
  12.  
  13. DEFTYPE.l
  14.  
  15. degrad.q = Pi/180                   ; Since the computer works in
  16.                                     ; radians, we need this value
  17.                                     ; to convert our angle to radians.
  18.                                     ; (Or something) :o)
  19.  
  20. MCPU Processor                      ; Tell Mildred which CPU it should use.
  21. Mc2pCPUmode Processor               ; Tell Mildred which CPU it should us for c2p.
  22.  
  23. MReserveBitmaps 2                   ; Tell Mildred that we're going to use 2 chunky bitmaps.
  24. MReservec2pWindows 1                ; Tell it we only need one c2p display.
  25.  
  26. .initgraphics
  27. MCludgeBitmap 0,320,210,?inclogo    ; Go fetch our original chunky image.
  28. MBitmap 1,384,256                   ; This will contain our chunky buffer.
  29.  
  30. Mc2pWindow 0,384,256                ; Setup structures for c2p conversions.
  31.  
  32. InitBank 0,384*256,$10002           ; Get some free CHIP memory.
  33. CludgeBitMap 0,384,256,8,Bank(0)    ; And make it a planar bitmap.
  34.  
  35. Dim scrtaglst.TagItem(7)            ; All this stuff sets up our
  36. scrtaglst(0)\ti_Tag = #SA_Left      ; Taglist for the screen we
  37. scrtaglst(0)\ti_Data = -32          ; want. As you can see, it's
  38. scrtaglst(1)\ti_Tag = #SA_Depth     ; rather non-standard.
  39. scrtaglst(1)\ti_Data = 8            ; it doesn't have to be, it's
  40. scrtaglst(2)\ti_Tag = #SA_Width     ; just that this routine needs
  41. scrtaglst(2)\ti_Data = 384          ; a larger screen to avoid
  42. scrtaglst(3)\ti_Tag = #SA_Height    ; clipping.
  43. scrtaglst(3)\ti_Data = 256
  44. scrtaglst(4)\ti_Tag = #SA_BitMap
  45. scrtaglst(4)\ti_Data = Addr BitMap (0)
  46. scrtaglst(5)\ti_Tag = #SA_ShowTitle
  47. scrtaglst(5)\ti_Data = 0
  48. scrtaglst(6)\ti_Tag = #SA_Draggable
  49. scrtaglst(6)\ti_Data = 0
  50. scrtaglst(7)\ti_Tag = #TAG_END      ; The most important tag of them all.
  51.  
  52.  
  53. ScreenTags 0,"MildredDEMO",&scrtaglst(0) ; Open our intuition screen.
  54.  
  55. DecodePalette 0,?incpal             ; Get our IncBin'ed palette info.
  56.  
  57. ShowPalette 0                       ; Attach our palette to the screen.
  58.  
  59. MUseBitmap 1                        ; Tell Mildred to use our main
  60.                                     ; chunky buffer (just in case)
  61.  
  62. Repeat                              ; Repeat our mainloop ....
  63.   Mc2p Bank(0)                      ; Convert our chunky buffer to
  64.                                     ; our planar bitmap.
  65.  
  66.   MCls                              ; Clear our chunky buffer
  67.  
  68.   For y=0 To 209                    ; Do the sine wavey bits.
  69.     x=Sin((y+deg)*degrad*5)*30      ; Rather slow, we could easily optimise thiis bit.
  70.                                     ; Requires an understanding for how Sine/Cosine works.
  71.     MScroll 0,y,320,1,32+x,y,0      ; Tell Mildred how to move our graphics arround, and where to put them.
  72.                                     ; in this case we take an area 320x1 from 0,y on bitmap 0,
  73.                                     ; and put it at 32+x,y
  74.   Next
  75.   deg+1                             ; do another degree on the sinewave.
  76.  
  77. Until RawStatus($45)                ; .... Until we press Escape.
  78.  
  79. End                                 ; End our nice program.
  80.  
  81.  
  82. Even                                ; put following data on an even address. Minor speed increase.
  83. .incpal
  84. IncBin "IntroLogo.PAL" ; Include our palette information in the binary.
  85.  
  86. Even                                ; Same as last time :o)
  87. .inclogo
  88. IncBin "IntroLogo.CNK" ; Include our chunky logo.
  89.  
  90.